﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RegistrationFeeManager.aspx.cs" Inherits="RegisterWeb.Manager.RegistrationFeeManager.RegistrationFeeManager" %>
<html> 
<head> 
	<title>Complex Toolbar for DataGrid - jQuery EasyUI Demo</title> 
        <link href="../../css/main.css" rel="stylesheet" type="text/css" />
        <link href="../../js/jquery-easyui-1.2.6/themes/gray/easyui.css" rel="stylesheet" type="text/css" />
    <link href="../../js/jquery-easyui-1.2.6/themes/icon.css" rel="stylesheet" type="text/css" />
	    <script src="../../js/jquery-easyui-1.2.6/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script src="../../js/jquery-easyui-1.2.6/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../../js/jquery-easyui-1.2.6/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
    	<script type="text/javascript">
        var url;
        var row1;
        var obj3="";
        var obj4 = "";
        var url1;
	    function newRegistrationFee() {
	        $('#dlg').dialog('open').dialog('setTitle', '添加价格');
	        $('#fm').form('clear');
	        url = 'ashx/RegistrationFeeManagerService.ashx?action=add';
	    }
	    function editRegistrationFee() {
	        var row = $('#dg').datagrid('getSelected');
	        if (row) {
	            $('#dlg').dialog('open').dialog('setTitle', '修改价格');
	            $('#fm').form('load', row);
	            url = 'ashx/RegistrationFeeManagerService.ashx?action=updata&RegistrationFee_ID=' + row.RegistrationFee_ID;
	        }
	    }
	    function saveRegistrationFee() {
	        $('#fm').form('submit', {
	            url: url,
	            onSubmit: function () {
	                return $(this).form('validate');
	            },
	            success: function (result) {
	              //   alert(result);
	                var result = eval('(' + result + ')');
	                if (result.success) {
	                    $.messager.show({
	                        title: 'Success',
	                        msg: result.msg
	                    });
	                    $('#dlg').dialog('close'); 	// close the dialog
	                    $('#dg').datagrid('reload'); // reload the user data
	                } else {
	                    $.messager.show({
	                        title: 'Error',
	                        msg: result.msg
	                    });
	                }
	            }
	        });
	    }
	    function queryRegistrationFee() {
	      //  var dt = document.getElementById("datetime1").value;
	        //alert(dt);
	        obj3 = document.getElementsByName("hpname")[0].value;
	   
	        obj4 = document.getElementsByName("rfoutpatientype")[0].value;
	    
	        $('#dg').datagrid('options').url = "ashx/RegistrationFeeManagerService.ashx?action=get&hpname=" + obj3 + "&rfoutpatientype=" + obj4;
	        $('#dg').datagrid("reload");
        }
	    //  删除代码部分
	    function deleteRegistrationFee() {
	        var row = $('#dg').datagrid('getSelected');
	        if (row) {
	            $.messager.confirm('删除提示', '确定要删除' + row.RegistrationFee_ID + '吗', function (r) {
	                if (r) {
	                    $.post('ashx/RegistrationFeeManagerService.ashx', { RegistrationFee_ID: row.RegistrationFee_ID, action: 'delete' }, function (data, status) {
	                        if (data == "ok") {
	                            $('#dg').datagrid('reload');
	                            $.messager.show({
	                                title: 'Error',
	                                msg: '删除该用户成功!'
	                            });
	                        } else {
	                            $.messager.show({
	                                title: 'Error',
	                                msg: '删除该用户失败!'
	                            });
	                        }
	                    });
	                }
	            });
	        }
	    }


	    $(function () {
	      
	        url1 = "ashx/RegistrationFeeManagerService.ashx?action=get&hpname=" + obj3 + "&rfoutpatientype=" + obj4;
	        $('#dg').datagrid({
	            title: '挂号费管理',
	            iconCls: 'icon-edit',
	            width: 700,
	            height: 350,
	            toolbar: "#tb",
	            idField: 'RegistrationFee_ID',
	            url: url1,
	            pagination: true,
	            rownumbers: true,
	            fitColumns: true,
	            singleSelect: true,
	            columns: [[
                     { field: 'RegistrationFee_ID', title: '挂号费编号', width: 60 },
	    	    	 { field: 'Hospital_ID', title: '医院编号', width: 100 },
     	         	 { field: 'HospitalIname', title: '医院名', width: 100 },
			         { field: 'OutpatientTypename', title: '门诊类型', width: 70 },
                     { field: 'RegistrationFee_Menory', title: '费用', width: 70 }
                    ]]
	        });
	    });
        </script>

</head> 
<body> 
	<table id="dg"  >

	</table> 
	
	<div id="tb" style="padding:5px;height:auto"> 
		<div style="margin-bottom:5px"> 
			<a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true"  onclick="newRegistrationFee()">添加</a> 
			<a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true"  onclick="editRegistrationFee()">编辑</a> 
			<a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="deleteRegistrationFee()">删除</a> 
		</div> 
		<div> 
		     	医院名: 
		        	<input id="hospitalname" name="hpname" class="easyui-combobox" style="width:100px"
					url="ashx/HospitalInfoService.ashx"
					valueField="HosptialItemID" textField="HosptialItemName" panelHeight="auto"> 
                    门诊类型: 
	    		 <input   id="RegistrationFeeOutpatientType"   name="rfoutpatientype"  class="easyui-combobox" style="width:100px"
					url="ashx/ParametersService.ashx?type=regType"
					valueField="SystemParameter_ID" textField="SystemParameter_Name" panelHeight="auto"> 
			<a href="#" class="easyui-linkbutton" iconCls="icon-search" onclick="queryRegistrationFee()">查询</a> 
		</div> 
	</div> 
	<div id="dlg" class="easyui-dialog" style="width:500px;height:380px;padding:10px 20px"
			closed="true" buttons="#dlg-buttons">
		<div class="ftitle">挂号费信息</div>
		<form id="fm" method="post" novalidate>		
      
        	 <div class="fitem">
             <label>医院名：</label>
                <select id="hoistal" name="selectHosptial" id="selectHosptial" required="true" style="width:150px;">
            </select>
             <script type="text/javascript">
            $("#hoistal").combobox({
                url: "ashx/HospitalInfoService.ashx",
             valueField: "HosptialItemID",
             textField: "HosptialItemName",
             panelHeight: "auto"
             });
             </script>
            </div>
                   <div class="fitem">
                     <label>门诊类型：</label>
                      <select id="OutpatientType" name="RegistrationFee_OutpatientType"  id="RegistrationFee_OutpatientType"  required="true" style="width:150px;">
                      </select>
                           <script type="text/javascript">
                               $("#OutpatientType").combobox({
                                   url: "ashx/ParametersService.ashx?type=regType",
                                   valueField: "SystemParameter_ID",
                                   textField: "SystemParameter_Name",
                                   panelHeight: "auto"
                               });
                          </script>
                      </div>
			<div class="fitem">
				<label>费用:</label>
				<input name="RegistrationFee_Menory" class="easyui-validatebox" required="true">
			</div> 
		</form>
	</div>
	<div id="dlg-buttons">
		<a href="#" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveRegistrationFee()">保存</a>
		<a href="#" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')">关闭</a>
	</div>
</body> 
</html>